#ifndef __ENGINE_SERVER_DESC_included
#define __ENGINE_SERVER_DESC_included

#include <string>
#include <map>
#include <boost/lexical_cast.hpp>
#include "package.h"

using namespace std;

#define SERVER_PREFIX_FORWARD  "forward://"
#define SERVER_PREFIX_BACKWARD  "backward://"
#define SERVER_PREFIX_PROXY  "proxy://"

enum {
	SERVER_TYPE_UNKNOWN = 0,
	SERVER_TYPE_FORWARD = 1,
	SERVER_TYPE_BACKWARD = 2,
	SERVER_TYPE_PROXY = 3
};

namespace Engine {

class CServerDescriptor {

	map<string, string> mParams;

public :
	int mType;
	string mIp;
	int mPort;
	
	CServerDescriptor() : mType(SERVER_TYPE_UNKNOWN), mPort(0) 
	{ }

	CServerDescriptor(string& desc);

	string& GetParameter(string& name) {
		map<string, string>::iterator i = mParams.find(name);
		if(i != mParams.end()) return i->second;
		else return CPackage::NULL_STRING;
	}
};

}

#endif //